source env.sh

page_title="$(cat "$1/name" | escape)"

cat <<EOF
<!DOCTYPE html>

<html>

	$(source scripts/head.sh)

	<body>

		$(source scripts/header.sh)

		<main>
			<h2>$page_title</h2>
EOF

if [ -f "$1/synonyms" ]; then
	echo '<h3>Synonyms</h3>'

	echo '<ul>'
	while read -r synonym; do
		echo "<li>$(escape "$synonym")</li>"
	done <"$1/synonyms"
	echo '</ul>'
fi

cat <<EOF
			$(md <"$1/index.md" | offset_headings 2)
		</main>

	</body>

</html>
EOF
